﻿using XfTech.SmartTms.Localization;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.Localization;

namespace XfTech.SmartTms.Permissions
{
    public class SmartTmsPermissionDefinitionProvider : PermissionDefinitionProvider
    {
        public override void Define(IPermissionDefinitionContext context)
        {
            var myGroup = context.AddGroup(SmartTmsPermissions.GroupName); //定义权限组
            //Define your own permissions here. Example:
            //myGroup.AddPermission(SmartTmsPermissions.MyPermission1, L("Permission:MyPermission1"));
            
            //定义一级权限
            var pd=myGroup.AddPermission(SmartTmsPermissions.PermissionVechiles, L("Permission:PermissionVechiles"));
            //定义子权限
            pd.AddChild(SmartTmsPermissions.PermissionVechilesCreate);
            pd.AddChild(SmartTmsPermissions.PermissionVechilesDelete);
            pd.AddChild(SmartTmsPermissions.PermissionVechilesUpdate);
            pd.AddChild(SmartTmsPermissions.PermissionVechilesRead);

        }

        private static LocalizableString L(string name)
        {
            return LocalizableString.Create<SmartTmsResource>(name);
        }
    }
}
